package history.model;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;

import org.springframework.orm.ibatis.SqlMapClientTemplate;

import to.HistoryTO;

public class HistoryDAO {
	private SqlMapClientTemplate sqlMap;
	public HistoryDAO(SqlMapClientTemplate sqlMap){
		this.sqlMap = sqlMap;
	}
	
	public void insertHistory(HistoryTO hto) throws SQLException{
		sqlMap.insert("insertHistory", hto);
	}
	
	public void updateHistory(HistoryTO hto) throws SQLException{
		sqlMap.update("updateHistory", hto);
	}
	public void deleteHistoryByNO(String no) throws SQLException{
		sqlMap.delete("deleteHistoryByNo", no);
	}
	
	@SuppressWarnings("unchecked")
	public ArrayList<HistoryTO> selectHistoryByMemberPhone(HashMap<String,Object> condition) throws SQLException{
		return (ArrayList<HistoryTO>) sqlMap.queryForList("selectRideHistory", condition);
	}
}
